Action hook 'delete_{$taxonomy}'

in WP Core File wp-includes/taxonomy.php at line 2227

View Source

delete_{$taxonomy}

Action Hook
Description
Fires after a term in a specific taxonomy is deleted. The dynamic portion of the hook name, `$taxonomy`, refers to the specific taxonomy the term belonged to. Possible hook names include: - `delete_category` - `delete_post_tag`

Hook Information

File Location wp-includes/taxonomy.php View on GitHub
Hook Type Action
Line Number 2227

Hook Parameters

Type Name Description
int $term Term ID.
int $tt_id Term taxonomy ID.
WP_Term $deleted_term Copy of the already-deleted term.
array $object_ids List of term object IDs.

Usage Examples

Basic Usage
<?php
// Hook into delete_{$taxonomy}
add_action('delete_{$taxonomy}', 'my_custom_function', 10, 4);

function my_custom_function($term, $tt_id, $deleted_term, $object_ids) {
    // Your custom code here
}

Source Code Context

wp-includes/taxonomy.php:2227 - How this hook is used in WordPress core
<?php
2222  	 * @param int     $term         Term ID.
2223  	 * @param int     $tt_id        Term taxonomy ID.
2224  	 * @param WP_Term $deleted_term Copy of the already-deleted term.
2225  	 * @param array   $object_ids   List of term object IDs.
2226  	 */
2227  	do_action( "delete_{$taxonomy}", $term, $tt_id, $deleted_term, $object_ids );
2228  
2229  	return true;
2230  }
2231  
2232  /**

PHP Documentation

<?php
/**
	 * Fires after a term in a specific taxonomy is deleted.
	 *
	 * The dynamic portion of the hook name, `$taxonomy`, refers to the specific
	 * taxonomy the term belonged to.
	 *
	 * Possible hook names include:
	 *
	 *  - `delete_category`
	 *  - `delete_post_tag`
	 *
	 * @since 2.3.0
	 * @since 4.5.0 Introduced the `$object_ids` argument.
	 *
	 * @param int     $term         Term ID.
	 * @param int     $tt_id        Term taxonomy ID.
	 * @param WP_Term $deleted_term Copy of the already-deleted term.
	 * @param array   $object_ids   List of term object IDs.
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 4
  • File: wp-includes/taxonomy.php
Related Hooks

Related hooks will be displayed here in future updates.